@extends('mbcore.baseadmin::layout.iframe')
@section('title', '后台首页')

@section('content')
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="row">
                    <div class="col-sm-12">

                        <div class="row row-sm text-center">
                            <div class="col-xs-3">
                                <div class="panel item" style="background-color: slateblue;">
                                    <div class="h2 text-info font-thin h1">10</div>
                                    <span class="text-muted text-xs">今日预报名</span>
                                    <div class="top text-right w-full">
                                        <i class="fa fa-caret-down text-warning m-r-sm"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-3">
                                <div class="panel item bg-info">
                                    <div class="h2 text-fff font-thin h1">5</div>
                                    <span class="text-muted text-xs">今日面试</span>
                                    <div class="top text-right w-full">
                                        <i class="fa fa-caret-down text-warning m-r-sm"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-3">
                                <div class="panel item bg-primary">
                                    <div class="h2 text-fff font-thin h1">2</div>
                                    <span class="text-muted text-xs">今日入职</span>
                                    <div class="top text-right w-full">
                                        <i class="fa fa-caret-down text-warning m-r-sm"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-3">
                                <div class="panel item" style="background-color: darkgreen;">
                                    <div class="font-thin h2">0 </div>
                                    <span class="text-muted text-xs">今日离职</span>
                                    <div class="bottom text-right">
                                        <i class="fa fa-caret-up text-warning m-l-sm"></i>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="row row-sm text-center">
                            <div class="col-xs-3">
                                <div class="panel item" style="background-color: red;">
                                    <div class="h2 text-info font-thin h2">我的激活码</div>
                                    <span class="text-muted text-xs">AC785J</span>
                                    <div class="top text-right w-full">
                                        <i class="fa fa-caret-down text-warning m-r-sm"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-3">
                                <div class="panel item bg-info" style="background-color: yellowgreen;">
                                    <div class="h2 text-fff font-thin h2">购买账号总数</div>
                                    <span class="text-muted text-xs">421个</span>
                                    <div class="top text-right w-full">
                                        <i class="fa fa-caret-down text-warning m-r-sm"></i>
                                    </div>
                                </div>
                            </div>

                            <div class="col-xs-3">
                                <div class="panel item" style="background-color: rosybrown;">
                                    <div class="font-thin h2">已使用账号总数</div>
                                    <span class="text-muted text-xs">128个</span>
                                    <div class="bottom text-right">
                                        <i class="fa fa-caret-up text-warning m-l-sm"></i>
                                    </div>
                                </div>
                            </div>

                            <div class="col-xs-3">
                                <div class="panel item bg-primary" style="background-color:darkslategray;">
                                    <div class="h2 text-fff font-thin h2">系统有效期</div>
                                    <span class="text-muted text-xs">2023年03月19日到期</span>
                                    <div class="top text-right w-full">
                                        <i class="fa fa-caret-down text-warning m-r-sm"></i>
                                    </div>
                                </div>
                            </div>
                        </div>


                    </div>
                </div>
            </div>

        </div>
    </div>
@stop

@push('startcss')
    <link href="{{ config('mbcore_baseadmin.baseadmin_assets_path')}}/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
@endpush

@section('myscript')
    <script src="{{ config('mbcore_baseadmin.baseadmin_assets_path')}}/js/plugins/sweetalert/sweetalert.min.js"></script>
    <script>
        function show1(){
            swal({
                title: "您的账号还未激活",
                inputPlaceholder: "请输入激活码，已激活账号，否则系统无法使用",
                type: "input",
                showCancelButton: false,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "激活",
                closeOnConfirm: false
            }, function (inputValue) {
                var url = '{{ route("v1.admin.activateAccount") }}'
                $.ajax({
                    type: "POST",
                    url: url,
                    data:{
                        'activation_code':inputValue,
                    },
                    success: function(data){
                        console.log(data);
                        console.log(data.code);
                        if (data.code == 200){
                            // swal("操作完成",'账号已激活', "success");
                            swal({
                                title: "操作完成",
                                text: "账号已激活",
                                type: "success",
                                showCancelButton: false,
                                confirmButtonColor: "#DD6B55",
                                confirmButtonText: "关闭",
                                closeOnConfirm: false,
                                timer:3000,
                            })
                        }else{
                            swal({
                                title: "账号激活失败",
                                text: data.msg,
                                type: "error",
                                showCancelButton: false,
                                confirmButtonColor: "#DD6B55",
                                confirmButtonText: "重新激活",
                                closeOnConfirm: false,
                            },function (){
                                show1();
                            })
                        }
                    }
                });
            })
        }
        // show1();

        jQuery.extend({
            "activateAccount": function () {
                swal({
                    title: "您的账号还未激活",
                    inputPlaceholder: "请输入激活码，已激活账号，否则系统无法使用",
                    type: "input",
                    showCancelButton: false,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "激活",
                    closeOnConfirm: false
                }, function (inputValue) {
                    var url = '{{ route("v1.admin.activateAccount") }}'
                    $.ajax({
                        type: "POST",
                        url: url,
                        data:{
                            'activation_code':inputValue,
                        },
                        success: function(data){
                            console.log(data);
                            console.log(data.code);
                            if (data.code == 200){
                                // swal("操作完成",'账号已激活', "success");
                                swal({
                                    title: "操作完成",
                                    text: "账号已激活",
                                    type: "success",
                                    showCancelButton: false,
                                    confirmButtonColor: "#DD6B55",
                                    confirmButtonText: "关闭",
                                    closeOnConfirm: false,
                                    timer:3000,
                                })
                            }else{
                                swal({
                                    title: "账号激活失败",
                                    text: data.msg,
                                    type: "error",
                                    showCancelButton: false,
                                    confirmButtonColor: "#DD6B55",
                                    confirmButtonText: "重新激活",
                                    closeOnConfirm: false,
                                },function (){
                                    show1();
                                })
                            }
                        }
                    });
                })
                return true;
            },
        });
        // $.activateAccount();
    </script>
@stop
